﻿using LiteBlog.Repositories.Common;
using LiteBlog.XmlLayer.Mocks.Constants;
using Moq;
using System.Xml.Linq;

namespace LiteBlog.Repositories.Mocks
{
    public class SettingsDataMock
    {
        public static IXmlHelper GetMock()
        {
            var mocked = Mock.Of<IXmlHelper>();
            var mock = Mock.Get<IXmlHelper>(mocked);

            var root = new XElement(Elem.Settings,
                          new XElement(Elem.Name, SettingsDataTestConstants.NameSetting),
                          new XElement(Elem.Tagline),
                          new XElement(Elem.UseImage, false),
                          new XElement(Elem.Url),
                          new XElement(Elem.PostCount, SettingsDataTestConstants.PostCountSetting),
                          new XElement(Elem.CommentModeration, SettingsDataTestConstants.ModerationSetting),
                          new XElement(Elem.Timezone),
                          new XElement(Elem.Skin),
                          new XElement(Elem.LogFile),
                          new XElement(Elem.LogLevel),
                          new XElement(Elem.AppKey),
                          new XElement(Elem.AppSecret),
                          new XElement(Elem.AccessToken),
                          new XElement(Elem.ShouldBackup, false));

            mock.Setup(x => x.Load(It.IsAny<string>()))
                 .Returns(root);

            return mocked;
        }
    }
}
